package com.hsq.file_;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class CopyFile {
    public static void main(String[] args) {
        String file1, file2;
        int ch = 0;
        file1 = "D:\\git_turtle\\news1.txt";
        file2 = "D:\\git_turtle\\news2.txt";
        try {
            FileInputStream fis = new FileInputStream(file2);
            FileOutputStream fos = new FileOutputStream(file1);
            int size = fis.available();
            System.out.println("字节有效数：" + size);
            while ((ch = fis.read()) != -1){
                System.out.write(ch);
                fos.write(ch);
            }
            fis.close();
            fos.close();
        } catch (IOException e) {
            System.out.println(e.toString());
        }

    }
}
